import axios from 'axios'

export const login = (params) => {
  return axios.post('http://localhost:9090/user/login', params)
}
export const register = (params) => {
  return axios.post('http://localhost:9090/user/add', params)
}
export const getVideo = () => {
  return axios.get('http://localhost:9090/video/page?page=1&pageSize=100')
}
export const getFoods = () => {
  return axios.get('http://localhost:9090/food/page?page=1&pageSize=100')
}
export const getBooks = () => {
  return axios.get('http://localhost:9090/book/page?page=1&pageSize=100')
}
export const getRecord = (id) => {
  return axios.get(`http://localhost:9090/daily/page?userid=${id}&page=1&pageSize=30`)
}
export const upload = (params) => {
  return axios.post('http://localhost:9090/upload', params)
}
export const updateUser = (params) => {
  return axios.put('http://localhost:9090/user/update', params)
}
export const addRecord = (params) => {
  return axios.post('http://localhost:9090/daily/add', params)
}
export const updateRecord = (params) => {
  return axios.put('http://localhost:9090/daily/update', params)
}
export const addCom = (params) => {
  return axios.post('http://localhost:9090/community/add', params)
}
export const getCom = () => {
  return axios.get(`http://localhost:9090/community/all`)
}
export const getUser = () => {
  return axios.get(`http://localhost:9090/user/all`)
}
export const getUserById = (id) => {
  return axios.get(`http://localhost:9090/user/user/${id}`)
}
export const addChat = (params) => {
  return axios.post('http://localhost:9090/chat/add', params)
}
export const getChat = (userid, teacherid) => {
  return axios.get(`http://localhost:9090/chat/page?page=1&pageSize=1&userid=${userid}&teacherid=${teacherid}`)
}
export const updateChat = (params) => {
  return axios.put('http://localhost:9090/chat/update', params)
}

export const getGuide = () => {
  return axios.get('http://localhost:9090/guide/page?page=1&pageSize=100')
}

export const addDaily = (params) => {
  return axios.post('http://localhost:9090/daily/add', params)
}